Field of the Invention
The present invention relates to data storage devices and in particularly relates to flash memory control methods.
Description of the Related Art
Today's data storage devices generally use a flash memory as a storage medium. A flash memory is commonly used in memory cards, USB flash devices, solid-state drives, and so on. In another application with multi-chip package technology, a flash memory and a controller are combined in one package as an embedded multi-media card (e.g. eMMC).
The storage space of a flash memory is generally divided into a plurality of physical blocks. Each physical block includes a plurality of physical pages. When updating data within the flash memory, the new data is not overwritten on the same storage space. Instead, the new data is stored in a spare space. The spare space may be provided by the same physical block that stores the old data. Or, the spare space may be provided by another physical block that is different from the one storing the old data. After the data is updated, the old data is regarded as invalid. A physical block that contains a lot of invalid data should be cleaned by a garbage collection mechanism. By copying valid data to another space, only invalid data remains. The physical block only containing invalid data can be released by an erase operation. Specifically, to release and reuse a physical block, the required erase operation is performed on the whole physical block. The management of the storage space of flash memory, therefore, is obviously more complex than other types of storage mediums. The maintenance of the mapping information between logical addresses and physical addresses is also an important topic in flash memory control.